﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Aletfa.LightManager.Effects
{
    public sealed class ActionEffect : IGameEffect
    {
        public AlterEffectType Type { get; set; }

        public string Perform(Unit target)
        {
            switch (this.Type)
            {
                case AlterEffectType.Add:
                    target.CurrentActions++;
                    return string.Format("{0} guadagna un'azione", target.Name);
                case AlterEffectType.Remove:
                    target.CurrentActions--;
                    if (target.CurrentActions < 0) target.CurrentActions = 0;
                    return string.Format("{0} perde un'azione", target.Name);
                case AlterEffectType.Reset:
                    target.CurrentActions = 3;
                    return string.Format("{0} è di nuovo a 3 azioni", target.Name);
            }
            throw new NotImplementedException();
        }

        public string Undo(Unit target)
        {
            switch (this.Type)
            {
                case AlterEffectType.Add:
                    target.CurrentActions--;
                    if (target.CurrentActions < 0) target.CurrentActions = 0;
                    return string.Format("{0} perde un azione", target.Name);
                case AlterEffectType.Remove:
                    target.CurrentActions++;
                    return string.Format("{0} guadagna un azione", target.Name);
                case AlterEffectType.Reset:
                    throw new NotImplementedException();
            }
            throw new NotImplementedException();
        }

        /// <inheritdoc />
        public bool IsTemporary { get; set; }

        /// <inheritdoc />
        public bool IsOneShot
        {
            get { return true; }
        }
    }
}
